<template>
  <!--<div id="wrapper">-->
  <!--<iframe-->
  <!--:src="base + '?file=' + url"-->
  <!--:width="width"-->
  <!--:height="height"-->
  <!--class="iframe-placeholder"></iframe>-->
  <!--</div>-->
  <div class="iframeBoxBody">
    {{url}}
    <img src="../../assets/image/closeimg.png" alt="" @click.stop="dialogVisible=false">
    <iframe
            id="show-iframe"
            frameborder=0
            name="showHere"
            scrolling=auto
            :src="base + '?file=' + url"
            :width="width"
            :height="height"
            class="iframeBoxLine">
    </iframe>
  </div>
</template>

<script>
  import {ipcRenderer} from 'electron'

  export default {
    name: 'landing-page',
    components: {},
    props: {
      url: {
        type: String,
        default: ''
      },
      width: {
        type: Number,
        default: 750
      },
      height: {
        type: Number,
        default: 600
      }
    },
    watch: {
      visible () {
        this.dialogVisible = this.visible
      }
    },
    data () {
      return {
        dialogVisible: false,
        base: ''
      }
    },
    computed: {
      // 讲义文件名
      name () {
        const uri = decodeURI(this.url)
        const arr = uri.split('/')
        const len = arr.length
        console.log('链接12131321', uri)
        return arr[len - 1]
      }
    },
    created () {
      // 获取viewer.html的位置
      ipcRenderer.send('getUrl')
    },
    mounted () {
      ipcRenderer.on('recieve', (e, arg) => {
        console.log('文件路径', arg)
        this.base = arg
      })
    }
  }
</script>


